#coding:utf8
SNR = range(-10,21)
a = [0.27380081436486214, 0.28, 0.2966587677725116, 0.32363059875842736, 0.3454822775515653,
  0.37011227554, 0.3916167145, 0.415221280, 0.426281289, 0.442093318,
  0.44719978639,0.47, 0.5027685, 0.54129363, 0.588812495,
  0.62655563714, 0.6734530405, 0.7147420065, 0.750817702, 0.8226673786796609,
  0.87078232481, 0.9005808029, 0.9339416594, 0.972031239, 0.9761491222214805,
  0.98633664499, 0.9970963220, 0.9992657365, 0.999464721, 0.999432614,1.0]
b = [0.20, 0.23, 0.24, 0.27,0.2925,
  0.33,0.345,0.3780,0.395,0.4,
  0.415,0.435,0.455,0.485,0.52,
  0.56,0.588,0.61,0.65,0.70,
  0.84,0.87,0.92,0.94,0.96,
  0.978,0.988,0.997,0.9992,0.9997,1]
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif']=['simhei'] #用来正常显示中文标签

plt.rcParams['axes.unicode_minus']=False #用来正常显示负号

a = [0.95*(1-x) for x in a]
b = [0.95*(1-x) for x in b]
line_lrs, = plt.plot(SNR,a, 'rv-', label='RLS')
line_mlp, = plt.plot(SNR,b, 'go-', label='LMS')
plt.legend([line_lrs,line_mlp],['RLS', 'LMS'])
plt.xlabel(u"信噪比(dB)", fontsize=16)
plt.ylabel(u"误符号率", fontsize=16)
plt.yscale('log')
plt.grid(True)
plt.ylim(0,1)
# plt.show()

plt.savefig('rls_lms.png')

# print c[0]



# line_up, = plt.plot([1,2,3], label='Line 2')
# line_down, = plt.plot([3,2,1], label='Line 1')
# plt.legend([line_up, line_down], ['Line Up', 'Line Down'])
# plt.show()
